#include <stdio.h>

int main(){
	int a,b,t;


	a=12,b=18;
	while(b != 0){
		t = a%b;
		a = b;
		b = t;
	}
	printf("%d",a);

	return 0;
}